class Solution {
    public int singleNumber(int[] nums) {
        int single = 0;//任何数与 0异或都为这个数本身
        for (int x:nums) {
            single = single ^ x; //数组所有元素依次进行异或运算,相等元素异或得0
        }
        return single;
    }
}